package priv.yiyuan.example.design.visitor;

import priv.yiyuan.example.design.visitor.node.BinaryExpression;
import priv.yiyuan.example.design.visitor.node.VariableDeclaration;

/**
 * 类型检查访问者
 *
 * @author YiYuan
 * @data 2025/7/30
 * @apoNote
 */
public class TypeCheckingVisitor implements AstVisitor {

    @Override
    public void visit(VariableDeclaration node) {

        System.out.println("Checking type for variable " + node.getName() + ": " + node.getType());

    }

    @Override
    public void visit(BinaryExpression node) {
        System.out.println("Checking operator " + node.getOperator() + " compatibility");
        node.getLeft().accept(this);
        node.getRight().accept(this);
    }
}
